home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C06 / Stash2.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  619 b   |  25 lines

  1. //: C06:Stash2.h
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // With constructors & destructors
  7. #ifndef STASH2_H
  8. #define STASH2_H
  9.  
  10. class Stash {
  11.   int size;      // Size of each space
  12.   int quantity;  // Number of storage spaces
  13.   int next;      // Next empty space
  14.   // Dynamically allocated array of bytes:
  15.   unsigned char* storage;
  16.   void inflate(int increase);
  17. public:
  18.   Stash(int size);
  19.   ~Stash();
  20.   int add(void* element);
  21.   void* fetch(int index);
  22.   int count();
  23. };
  24. #endif // STASH2_H ///:~
  25.